<?php
namespace Orm\Coupon;

class CouponModel extends \Base\BaseOrmModel{

    function __construct()
    {
        parent::__construct();
        $this->table = 't_coupon';
    }
    //获取优惠券的总数
    public function getCouponTotal(){
        $sql ='
            SELECT COUNT(*) as total_num FROM t_coupon WHERE is_use = 0 AND is_del =0
        ';
        $total_num = $this->_fetch($sql,1);
        $total_num = reset($total_num);
        return $total_num["total_num"];
    }
}